<% layout('/layout/default.html', {title: '已办任务', libs: ['dataGrid']}){ %>
<div class="main-content">
  <div class="box box-main">
    <div class="box-header">
      <div class="box-title">
        <i class="fa fa-cubes"></i> 已办任务
      </div>
      <div class="box-tools pull-right">
        <a class="btn btn-default" href="#" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
      </div>
    </div>
    <div class="box-body">
      <form action="${ctx}/act/task/historicData" class="form-inline hide" id="searchForm" method="post">
        <div class="form-group">
          <label class="control-label">任务类型：</label>
          <div class="control-inline">
            <#form:select path="procDefKey" name="label" data="getDictList:act_type" class="form-control required">
          </
          #form:select>
        </div>
    </div>
    <div class="form-group">
      <label class="control-label">完成时间：</label>
      <div class="control-inline">
        <input class="form-control required " id="beginDate" maxlength="64" name="beginDate"
               onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"
               readonly="readonly" value=""/> -
        <input class="form-control required " id="endDate" maxlength="64" name="endDate"
               onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"
               readonly="readonly" value=""/>
      </div>
    </div>

    <div class="form-group">
      <button class="btn btn-primary btn-sm" type="submit">查询</button>
      <button class="btn btn-default btn-sm" type="reset">重置</button>
    </div>
    </form>
    <table id="dataGrid"></table>
    <div id="dataGridPage"></div>
  </div>
</div>
</div>
<% } %>
<script>
    //初始化DataGrid对象
    $('#dataGrid').dataGrid({
        searchForm: $("#searchForm"),
        columnModel: [
            {header: '流程名称', name: 'procDefname', index: 'procDefname', width: 100, align: "center"},
            {
                header: '当前环节',
                name: 'taskName',
                index: '',
                width: 90,
                align: "center",
                formatter: function (val, obj, row, act) {
                    return row.processIsFinished == "finished" ? '<a href="${ctx}/act/task/diagramViewer?definitionId=' + row.procDefId + '&hisInsId=' + row.procInsId + '" class="btnList" title="流程图查看" data-type="diagram">' + val + '</a>' : '<a href="${ctx}/act/task/diagramViewer?definitionId=' + row.procDefId + '&instanceId=' + row.procInsId + '" class="btnList" title="流程图查看" data-type="diagram">' + val + '</a>';
                }
            },
            {
                header: '流程版本',
                name: 'procDefversion',
                index: 'procDefversion',
                width: 80,
                align: "center",
                formatter: function (val, obj, row, act) {
                    return 'V:' + val;
                }
            },
            {
                header: '完成时间',
                name: 'hisTaskEndTime',
                index: 'hisTaskEndTime',
                width: 100,
                align: "center",
                formatter: "date",
                formatoptions: {srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s'}
            },
            {
                header: '操作',
                name: 'actions',
                width: 100,
                sortable: false,
                title: false,
                align: "center",
                formatter: function (val, obj, row, act) {
                    var actions = [];
                <%
                    if (hasPermi('act:model:edit')) { %>
                        actions.push('<a href="/act/task/form?taskId=' + row.taskId + '&taskName=' + row.taskName + '&taskDefKey=' + row.taskDefKey + '&procInsId=' + row.procInsId + '&procDefId=' + row.procDefId + '&status=' + row.status + ' " class="btnList" title="详情查看" >查看详情</a>')
                        < %
                    }
                %>
                    return actions.join('');
                }
            }
        ],
        // 加载成功后执行事件
        ajaxSuccess: function (data) {

        }
    });
</script>
